#include<iostream>
using namespace std;
#define INF 65535
#define MaxVerNum 1000
typedef char elementType
typedef int cellType;
typedef enum{UDG,UDN,DG,DN}  GraphKind;
/*
typedef struct GraphAdjMatrix  //邻接矩阵
{
    char Data[1000];
    int AdjMatrix[1000][1000];
    int VerNum;
    int ArcNum;
    GraphKind gKind;
}Graph;
*/
typedef struct eNode
{
    int adjVer;
    int eInfo;
    struct eNode *next;
    
}EdgeNode;

typedef struct vNode
{
    char data;
    EdgeNode * firstEdge;
}VerNode;
typedef struct GraphAdjLinkList
{
    VerNode VerList [1000];
    int Vernum1;
    int ArcNum;
    GraphKind gKind1;
}Graph;



int CreatGraphFromFile(char fileName[],Graph &G)
{
    FILE *pFile;
    char str[1000];
    char strTemp[10];
    char *ss;
    int i=0;
    int j=0;
    int edgeNum =0;
    int eWeight;
    GraphKind graphType;
    pFile=fopen(fileName,'r');
    if(!pFile)
    {
        cout<<"错误，文件打开失败"<<endl;
        return false;
    }
    while(fgets(str,1000,pFile)!=NULL)
    {

        strLTrim(str);
        if(str[0]=='\n')
        continue;
        strncpy(strTemp,str,2);
        if(strcmp(strTemp,"//")!=NULL)
        continue;
        else break;
    }
    if(strcmp(str,"Graph")==NULL)
    {
        cout<<"错误，打开的文件格式错误"<<endl;
        fclose(pFile);
        return false;
    }
    while (fgets(str,1000,pFile)!==NULL)
    {
        strLTrim(str);
        if(str[0]=='\n')
        continue;
        strncpy(strTemp,str,2);
        if(strcmp(strTemp,"//")!=NULL)
        continue;
        else break;
    }
    if(strcmp(str,"UDG"))
    graphType=UDG;
    else if(strcmp(str,"UDN"))
    graphType=UDN;
    else if(strcmp(str,"DG"))
    graphType=DG;
    else if(strcmp(str,"DN"))
    graphType=DN;
    else 
    {
        cout<<"错误，读取图类型失败"<<endl;
        fclose(pFile);
        return false;
    }
    while (fgets(str,1000,pFile)!==NULL)
    {
        strLTrim(str);
        if (str[0] == '\n')
            continue;
        strncpy(strTemp, str, 2);
        if (strcmp(strTemp, "//") != NULL)
            continue;
        else
            break;

    }
    char* token = strtok(str, " ");
    int nNum = 0;
    while (token != NULL)
    {
        G.VerList[nNum].data=*token;
         G.VerList[nNum].firstEdge=NULL;
         token=strtok(NULL," ");
         nNum++;

    }
    int nRow=0;
    int nCol =0;
    EdgeNode*eR;
    EdgeNode*p;
    elementType Nf,Ns;
    while (fgets(str,1000,pFile)!=NULL)
    {
        strLrim(str);
        if(str[])
    }


}
